/* 全局样式 */
.soul-hunter.sheet,
.soul-hunter.sheet form {
    font-family: "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 弹窗样式 */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    border: 2px solid #4a5568;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.popup-header {
    background: linear-gradient(90deg, #2d3748 0%, #4a5568 100%);
    padding: 16px 20px;
    border-bottom: 2px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    margin: 0;
    color: #e0e0e0;
    font-size: 18px;
}

.popup-close {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.popup-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.popup-body {
    padding: 20px;
}

.item-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.item-type-option {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border: 2px solid #4a5568;
    border-radius: 8px;
    padding: 20px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.item-type-option:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: #68d391;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.item-type-option i {
    font-size: 24px;
    color: #68d391;
}

.item-type-option span {
    font-weight: 500;
}

.description textarea{
    color: #fff;
}

/* 聊天卡片布局修复 */
.hunter-dice-roll {
    display: block;
}
.hunter-dice-roll .dice-details, .hunter-dice-roll details.dice-collapsible {
    overflow: hidden;
}
.hunter-dice-roll details.dice-collapsible > summary {
    cursor: pointer;
    padding: 6px 8px;
    color: #e0e0e0;
}
.hunter-dice-roll .dice-result {
    /* display: flex; */
    align-items: center;
    gap: 8px;
    /* flex-direction: column; */
    display: block;
    margin: 0 auto;
}
.hunter-dice-roll .dice-total-result {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}
.hunter-dice-roll .dice-total {
    font-weight: 700;
    font-size: 18px;
}
.dice-tooltip.expanded {
    display: block;
}
.dice-tooltip {
    display: block;
    margin-top: 6px;
}
.dice-formula {
    display: block;
}
.dice-rolls {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.hunter-dice-roll .success-level.success { color: #68d391; }
.hunter-dice-roll .success-level.failure { color: #f56565; }

.dice-roll{

}
.sheet-body button{
    color: #fff;
}
/* 灵能力标签样式 */
.power-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.power-tag {
    padding: 4px 8px;
    border: 1px solid #68d391;
    border-radius: 12px;
    background: rgba(104, 211, 145, 0.08);
    color: #e0e0e0;
}
.power-tag-add {
    padding: 4px 10px;
    border: 1px dashed #4a5568;
    border-radius: 12px;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
}
.power-tag-add:hover {
    border-color: #68d391;
}

/* 灵能力对话框选择按钮样式 */
.tag-select .tag-btn {
    padding: 6px 10px;
    margin: 4px;
    border: 1px solid #4a5568;
    border-radius: 10px;
    background: #2d3748;
    color: #e0e0e0;
}
.tag-select .tag-btn.active {
    background: #1a202c;
    border-color: #68d391;
}

/* 表单头部 */
.soul-hunter.sheet .sheet-header {
    background: linear-gradient(90deg, #2d3748 0%, #4a5568 100%);
    padding: 16px;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    max-height: 300px;
}
.sheet header.sheet-header img {
    width: 100%;
    height: 100%;
}
.soul-hunter.sheet .sheet-header .header-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 0.5;
}

.soul-hunter.sheet .sheet-header .profile-img{
    width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.soul-hunter.sheet .sheet-header .profile-img:hover {
    border-color: #63b3ed;
    box-shadow: 0 4px 12px rgba(99, 179, 237, 0.4);
    transform: scale(1.05);
}

.soul-hunter.sheet .sheet-header h1 {
    margin: 0;
    flex: 1;
}

.soul-hunter.sheet .sheet-header h1 input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    width: 100%;
}

.soul-hunter.sheet .sheet-header h1 input:focus {
    outline: 1px solid #63b3ed;
    border-radius: 4px;
    padding: 4px;
}

/* NPC表单头部样式 */
.soul-hunter.sheet.npc .sheet-header {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.soul-hunter.sheet.npc .sheet-header .profile-img {
    width: 100%;
    max-height: 200px;
}

/* 头部资源栏 */
.header-resources {
    display: grid;
    /* grid-template-columns: 1fr 1fr; */
    gap: 16px;
    align-items: start;
}

.header-name {
    grid-column: 1 / -1;
}

.header-name h1 {
    margin: 0 0 8px 0;
}

.header-name input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #4a5568;
    border-radius: 6px;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    width: 100%;
    padding: 6px 6px;
}

.header-name input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}
.soul-hunter.sheet .sheet-header .attributes,
.soul-hunter.sheet .sheet-header .resources {
    background: transparent;
    border: none;
    padding: 0;
}

.soul-hunter.sheet .sheet-header .attributes h3,
.soul-hunter.sheet .sheet-header .resources h3 {
    display: none;
}

.soul-hunter.sheet .sheet-header .attr-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.soul-hunter.sheet .sheet-header .attribute label {
    font-size: 11px;
}

.soul-hunter.sheet .sheet-header .attribute input {
    padding: 4px 6px;
    font-size: 14px;
}

.soul-hunter.sheet .sheet-header .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.soul-hunter.sheet .sheet-header .resource label {
    font-size: 11px;
}

.soul-hunter.sheet .sheet-header .resource-bar input {
    padding: 4px 6px;
}

.soul-hunter.sheet .sheet-header .resource-bar .style-action {
    padding: 4px 6px;
}

.soul-hunter.sheet .sheet-header .max-value {
    min-width: 28px;
}

.header-resources .resource-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
}

.header-resources .resource-bar label {
    color: #a0aec0;
    font-size: 12px;
    min-width: 40px;
}

/* 标签页导航 */
.sheet-tabs {
    display: flex;
    background: #2d3748;
    border-radius: 6px;
    margin: 16px;
    overflow: hidden;
}

.sheet-tabs .item {
    flex: 1;
    padding: 12px 16px;
    background: #2d3748;
    color: #a0aec0;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.sheet-tabs .item:hover {
    background: #4a5568;
    color: #e0e0e0;
}

.sheet-tabs .item.active {
    background: #4299e1;
    color: #fff;
}

/* 标签页内容 */
.tab-content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
}

/* 主要网格布局 */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.main-grid section {
    background: rgba(45, 55, 72, 0.8);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #4a5568;
}

.main-grid section h3 {
    margin: 0 0 16px 0;
    color: #4299e1;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #4a5568;
    padding-bottom: 8px;
}

/* 属性网格 */
.attr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.attribute {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attribute label {
    color: #a0aec0;
    font-size: 12px;
    font-weight: bold;
}

.attribute input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 8px;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

.attribute input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

/* 资源网格 */
.resource-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.resource {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resource label {
    color: #a0aec0;
    font-size: 12px;
    font-weight: bold;
}

.resource-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.resource-bar input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 6px 8px;
    color: #fff;
    text-align: center;
    flex: 1;
    min-width: 0;
}

.resource-bar span {
    color: #a0aec0;
    font-weight: bold;
}

.max-value {
    color: #63b3ed;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.resource-bar .style-action {
    background: #f6ad55;
    color: #1a202c;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    margin-left: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
}
.header-left .resource-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
}
.resource-bar .style-action:hover {
    background: #ed8936;
}

/* 技能网格 */
.skills-grid {
    display: grid;
    gap: 8px;
}

.skill-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.skill-row:hover {
    background: rgba(0, 0, 0, 0.4);
}

.skill-row label {
    color: #e0e0e0;
    min-width: 80px;
    font-weight: 500;
}

.skill-row input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 4px 8px;
    color: #fff;
    text-align: center;
    width: 50px;
}

.roll-button {
    background: #4299e1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.roll-button:hover {
    background: #3182ce;
}

.roll-button i {
    font-size: 14px;
}

/* 灵能力表单 */
.power-form {
    display: grid;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    color: #a0aec0;
    font-size: 12px;
    font-weight: bold;
}

.form-row input,
.form-row textarea,
.form-row select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 8px;
    color: #fff;
    resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

/* 战斗标签页 */
.combat-grid {
    display: grid;
    gap: 20px;
}

.combat-reset {
    margin-bottom: 12px;
    text-align: right;
}

.reset-combat-values {
    background: rgba(66, 153, 225, 0.2);
    border: 1px solid #4299e1;
    color: #63b3ed;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.reset-combat-values:hover {
    background: rgba(66, 153, 225, 0.3);
    border-color: #63b3ed;
    color: #90cdf4;
}

.combat-values,
.growth-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.combat-value,
.growth-value {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.combat-value label,
.growth-value label {
    color: #a0aec0;
    font-size: 12px;
    font-weight: bold;
}

.combat-value input,
.growth-value input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 8px;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

.combat-value small {
    color: #a0aec0;
    font-size: 10px;
    margin-top: 4px;
    text-align: center;
    font-style: italic;
}

/* 计算出的数值样式 */
.calculated-value {
    background: rgba(66, 153, 225, 0.2);
    border: 1px solid #4299e1;
    border-radius: 4px;
    padding: 8px;
    color: #63b3ed;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    min-width: 40px;
}

.calculated-value + small {
    color: #a0aec0;
    font-size: 10px;
    margin-top: 4px;
    display: block;
    text-align: center;
}

/* 时髦值选择弹窗样式 */
.style-choice {
    text-align: center;
}

.style-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.style-options button {
    background: #4299e1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.style-options button:hover {
    background: #3182ce;
}

.style-options button[data-level="0"] {
    background: #4a5568;
}

.style-options button[data-level="0"]:hover {
    background: #2d3748;
}

/* 时髦值获得显示样式 */
.style-gained {
    background: rgba(72, 187, 120, 0.2);
    border: 1px solid #48bb78;
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
    color: #68d391;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}

/* 狩魂者掷骰样式 */
.hunter-dice-roll {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border: 2px solid #4299e1;
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #4a5568;
}

.dice-formula {
    color: #a0aec0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
}

.dice-total {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.success-level {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 auto;
}

.success-level.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.success-level.failure {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

.dice-details {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.dice-breakdown,
.dice-results {
    margin-bottom: 12px;
}

.dice-breakdown:last-child,
.dice-results:last-child {
    margin-bottom: 0;
}

.breakdown-item,
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(74, 85, 104, 0.3);
}

.breakdown-item:last-child,
.result-item:last-child {
    border-bottom: none;
}

.breakdown-item .label,
.result-item .label {
    color: #a0aec0;
    font-size: 12px;
    font-weight: 500;
}

.breakdown-item .value,
.result-item .value {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.dice-toggle {
    text-align: center;
    margin-top: 12px;
}

.toggle-details {
    background: rgba(66, 153, 225, 0.2);
    border: 1px solid #4299e1;
    color: #63b3ed;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.toggle-details:hover {
    background: rgba(66, 153, 225, 0.3);
    border-color: #63b3ed;
    color: #90cdf4;
}

.toggle-details i {
    transition: transform 0.2s ease;
}

/* 背景表单 */
.background-form {
    display: grid;
    gap: 16px;
}

/* 物品管理 */
.items-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.item-create {
    background: #48bb78;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.item-create:hover {
    background: #38a169;
}

.items-list {
    display: grid;
    gap: 8px;
}

.item-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4a5568;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.item-entry:hover {
    background: rgba(0, 0, 0, 0.5);
}

.item-name {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.item-name img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
}

.item-name span {
    color: #e0e0e0;
}

.item-type {
    color: #a0aec0;
    font-size: 12px;
}

.item-controls {
    display: flex;
    gap: 8px;
}

.item-edit,
.item-delete {
    background: transparent;
    border: 1px solid #4a5568;
    color: #a0aec0;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.item-edit:hover {
    background: #4299e1;
    color: #fff;
    border-color: #4299e1;
}

.item-delete:hover {
    background: #e53e3e;
    color: #fff;
    border-color: #e53e3e;
}

/* 物品表单样式 */
.soul-hunter.sheet.item {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.soul-hunter.sheet.item .sheet-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.soul-hunter.sheet.item .sheet-header .item-img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.soul-hunter.sheet.item .sheet-header .item-img:hover {
    border-color: #63b3ed;
    box-shadow: 0 4px 12px rgba(99, 179, 237, 0.4);
    transform: scale(1.05);
}

/* NPC表单样式 */
.soul-hunter.sheet.npc {
    background: linear-gradient(135deg, #553c9a 0%, #7c3aed 100%);
}

.npc-grid {
    display: grid;
    gap: 16px;
    padding: 4px 8px;
}

.dice-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #4a5568;
}
.dice-result .dice-total {
    margin: auto;
}
/* 响应式设计 */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .attr-grid {
        grid-template-columns: 1fr;
    }
    
    .resource-grid {
        grid-template-columns: 1fr;
    }
    
    .combat-values,
    .growth-values {
        grid-template-columns: 1fr;
    }
    
    .items-header {
        flex-direction: column;
    }
    
    .sheet-tabs {
        flex-direction: column;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab.active {
    animation: fadeIn 0.3s ease-in-out;
}

/* 滚动条样式 */
.soul-hunter.sheet ::-webkit-scrollbar {
    width: 8px;
}

.soul-hunter.sheet ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.soul-hunter.sheet ::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.soul-hunter.sheet ::-webkit-scrollbar-thumb:hover {
    background: #63b3ed;
}